indexOf returns the index of the first instance of substr in s, or -1 if substr is not present in s.
(s, substr string)
| 975 | // indexOf returns the index of the first instance of substr in s, |
| 976 | // or -1 if substr is not present in s. |
| 977 | func indexOf(s, substr string) int { |
| 978 | for i := 0; i <= len(s)-len(substr); i++ { |
| 979 | if s[i:i+len(substr)] == substr { |
| 980 | return i |
| 981 | } |
| 982 | } |
| 983 | return -1 |
| 984 | } |
| 985 | |
| 986 | // mcpFromSDK adapts a toolsdk.Tool to go-mcp's server.ServerTool. |
| 987 | // It assumes that the tool responds with a valid JSON object. |