MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / BuildReadArguments

Function BuildReadArguments

internal/sessions/session_injection.go:196–221  ·  view source on GitHub ↗

BuildReadArguments constructs the arguments map for a file-read tool invocation.

(sess *Session, toolName, filePath string)

Source from the content-addressed store, hash-verified

194
195// BuildReadArguments constructs the arguments map for a file-read tool invocation.
196func BuildReadArguments(sess *Session, toolName, filePath string) map[string]any {
197 if sess == nil {
198 return map[string]any{"file_path": filePath}
199 }
200
201 schema := findToolSchema(sess, toolName)
202 if schema != nil {
203 if props, ok := schema["properties"].(map[string]any); ok {
204 for _, key := range []string{"file_path", "path", "file", "filename"} {
205 if _, exists := props[key]; exists {
206 return map[string]any{key: filePath}
207 }
208 }
209 // Fall back to first string property.
210 for key, propRaw := range props {
211 if prop, ok := propRaw.(map[string]any); ok {
212 if t, _ := prop["type"].(string); t == "string" {
213 return map[string]any{key: filePath}
214 }
215 }
216 }
217 }
218 }
219
220 return map[string]any{"file_path": filePath}
221}
222
223// BuildWriteArguments constructs the arguments map for a file-write tool invocation.
224func BuildWriteArguments(sess *Session, toolName, filePath, content string) map[string]any {

Calls 1

findToolSchemaFunction · 0.85