-
Notifications
You must be signed in to change notification settings - Fork 57
Description
The PHP MCP server appears to ignore PHPDoc @return annotations when building tool metadata and does not expose any outputSchema for tools discovered via attributes (e.g. #[McpTool]).
Input schemas are inferred from type hints and optional #[Schema] attributes, but output schemas are missing even when the return type is documented in PHPDoc. This makes it impossible to communicate structured return shapes to MCP clients without manual registration.
The example in the readme is therefore misleading:
/**
* Adds two numbers together.
*
* @param int $a The first number
* @param int $b The second number
* @return int The sum of the two numbers
*/
#[McpTool(name: 'add_numbers')]
public function add(int $a, int $b): int
{
return $a + $b;
}Expected behavior or feature request:
Either parse PHPDoc @return (or a dedicated PHPDoc tag) to derive an output schema when using attribute discovery, or
This limitation makes it difficult to document tool outputs and metadata consistently in projects that rely on discovery rather than manual withTool(...) registration.