micro/go-micro · error
name is required
Error message
name is required
What it means
The built-in "get_service" MCP tool handler requires the caller to supply the "name" input parameter identifying which registered service to look up. When the parameter is absent or an empty string, the handler returns "name is required" as the tool error.
Source
Thrown at gateway/mcp/mcp.go:460
names = append(names, svc.Name)
}
return map[string]interface{}{"services": names}, nil
},
})
addFramework(&Tool{
Name: "micro_registry_get",
Description: "Get details for a registered service including nodes and endpoints",
InputSchema: map[string]interface{}{
"type": "object",
"properties": map[string]interface{}{
"name": map[string]interface{}{"type": "string", "description": "Service name"},
},
},
Handler: func(input map[string]interface{}) (interface{}, error) {
name, _ := input["name"].(string)
if name == "" {
return nil, fmt.Errorf("name is required")
}
services, err := s.opts.Registry.GetService(name)
if err != nil {
return nil, err
}
return services, nil
},
})
addFramework(&Tool{
Name: "micro_store_list",
Description: "List keys in the data store",
InputSchema: map[string]interface{}{"type": "object", "properties": map[string]interface{}{}},
Handler: func(input map[string]interface{}) (interface{}, error) {
keys, err := store.List()
if err != nil {
return nil, err
}View on GitHub (pinned to 24529f1404)
Solutions
- Include a non-empty "name" string in the tool input: {"name": "myservice"}.
- Check the service name against what the registry reports (ListServices) — names are case-sensitive.
- On the client side, validate required params before sending the tools/call request.
Example fix
// before
{"method": "tools/call", "params": {"name": "get_service", "arguments": {}}}
// after
{"method": "tools/call", "params": {"name": "get_service", "arguments": {"name": "myservice"}}} Defensive patterns
Strategy: validation
Validate before calling
name, _ := input["name"].(string)
if name == "" {
return errors.New("get_service requires a non-empty 'name' argument")
} Type guard
func validName(input map[string]interface{}) (string, bool) {
n, ok := input["name"].(string)
return n, ok && n != ""
} Try / catch
result, err := callTool("get_service", map[string]interface{}{"name": svc})
if err != nil {
if strings.Contains(err.Error(), "name is required") {
// fix arguments and retry once
}
} Prevention
- Read the tool's inputSchema before calling and supply every required property.
- Treat tool error strings as contract violations and fix the caller, not the server.
- When driving tools with an LLM, constrain argument generation to the declared schema.
When it happens
Trigger: An MCP client calls the get_service tool with input {} or input {"name": ""} — the empty name fails the guard before Registry.GetService is invoked.
Common situations: An LLM omits the required argument in its tool call; a hand-written JSON-RPC client forgets the params.name field; schema/tools listing was cached and the client sends outdated arguments.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
AI-assisted analysis of micro/go-micro@24529f1404 (2026-09-01).
Data as JSON: /api/errors/c5466243a6d942e9.
Report an issue: GitHub.