Repository navigation
Dynamic Inputs #232
Unanswered
agardnerIT
asked this question in
Q&A
Replies: 2 comments
|
I am not sure I completely understand your question, but from what I can tell it looks like you are looking for Enums. You want the LLM to give specific structures of arguments. This might be challenging because you need to outline each and every way you want to allow the LLM to call a function. Either way, the solution to your problem lies in figuring out what you want in the JSON schema for your tool body. Here you can see the JSON schema spec. Also I provided an example below using enums in json schema. {
"properties": {
"filters": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["contains", "matchesPhrase", "equals", "startsWith", "endsWith", "regex"],
"description": "The type of filter operation to perform"
},
"field": {
"type": "string",
"description": "The field to filter on (e.g., 'body' or 'attributes.foo')"
},
"value": {
"type": ["string", "number", "boolean"],
"description": "The value to filter against"
}
},
"required": ["type", "field", "value"],
"additionalProperties": false
},
"description": "Array of filter operations to apply to the logs"
}
},
"type": "object",
"required": ["filters"],
"examples": [
{
"filters": [
{
"type": "contains",
"field": "body",
"value": "someText"
},
{
"type": "matchesPhrase",
"field": "attributes.foo",
"value": "bar"
}
]
}
]
} |
0 replies
|
I have the same issue。i split the filters by regex in my tools |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Pre-submission Checklist
Question Category
Your Question
I am new to MCP so feel free to challenge / correct anything here!
I have a third party API that accepts POST body like:
So I write a tool called
get_logsThis would retrieve only logs where the body contains
someTextandsomeOtherText.The model is smart enough to figure it needs to run the
get_logstool but how do I dynamically parameterise the filters?Note that
| filter contains(...)is just one option. It could be| filter matchesPhrase(attributes["foo"], "bar")to return structured logs where thefooattribute== barI can't figure out how to do that dynamic parameterisation (Python in particular). Maybe there's a different way?
All reactions